home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_plotutils.idb / usr / freeware / share / ode / chem.ode.z / chem.ode
Encoding:
Text File  |  1998-10-28  |  810 b   |  43 lines

  1. # This example does a chemical kinetics simulation, for the reaction:
  2. #
  3. #     A + 2B <==> C --> D
  4. #
  5. # The output displays the concentration of the species `C'
  6. # as a function of time.
  7. #
  8. # You may run this example by doing:
  9. #
  10. #    ode < chem.ode | graph -T X -C
  11. #
  12. # or alternatively, to get a real-time plot,
  13. #
  14. #    ode < chem.ode | graph -T X -C -x 0 10 -y 0 0.03
  15. #
  16. # To improve the shape of the plotted curve, you may
  17. # wish to spline it, by doing e.g.
  18. #
  19. #    ode < chem.ode | spline | graph -T X -C
  20. #
  21. # Alternatively, you could remove the `every 10' clause below.
  22.  
  23. # The three rate constants are:
  24. #    kf : A + 2B --> C
  25. #    kb : C --> A + 2B
  26. #    kd : C --> D
  27.  
  28. a' = kb*c - kf*a*b^2
  29. b' = kb*c - kf*a*b^2
  30. c' = kf*a*b^2 - kb*c - kd*c
  31. d' = kd*c
  32.  
  33. c = 0
  34. d = 0
  35. a = 0.1
  36. b = 1
  37.  
  38. kf = 1
  39. kb = 1
  40. kd = 1
  41. print t,c every 10
  42. step 0,10
  43.